#include "SypEngine.h"

#ifdef CHECKMEM
#include "mmgr.h"
#endif

namespace Syp
{
	void FrameBufferObject::destroyFrameBufferObject(FrameBufferObject* fbo)
	{
		delete fbo;
	}

	void FrameBufferObject::attachBuffer(BufferObject* bo)
	{
		buffers.push_back(*bo);
		Renderer::getRenderer().attachBuffer(this, bo);
	}

	void FrameBufferObject::attachTexture(TextureObj* tex)
	{
		Renderer::getRenderer().attachTexture(this, tex);		
	}

	PInt FrameBufferObject::getWidth()
	{
		return width;
	}

	PInt FrameBufferObject::getHeight()
	{
		return height;
	}

	FrameBufferObject::~FrameBufferObject()
	{
		Renderer::getRenderer().deleteFrameBufferObject(this);
	}

	PInt FrameBufferObject::getId()
	{
		return id;
	}

	void FrameBufferObject::bindFBO()
	{
		Renderer::getRenderer().bindFBO(this);
	}

	void FrameBufferObject::unBindFBO()
	{
		Renderer::getRenderer().unBindFBO();
	}
}